package com.molichuxing.services.property;

public enum VehicleEngineTypeEnum {
    /**
     * 36KW电动机
     */
    THIRTY_SIX_KW_MOTOR (1, "36KW电动机");


    int value;
    String name;

    VehicleEngineTypeEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }


    /**
     * 通过value获取枚举的name
     *
     * @param value
     * @return
     */
    public static String getName(int value) {
        VehicleEngineTypeEnum enumerate = getEnum(value);
        return enumerate == null ? null : enumerate.getName();
    }

    /**
     * 通过value获取枚举
     *
     * @param value
     * @return
     */
    public static VehicleEngineTypeEnum getEnum(int value) {
        for (VehicleEngineTypeEnum enumerate : VehicleEngineTypeEnum.values()) {
            if (enumerate.getValue() == value) {
                return enumerate;
            }
        }
        return null;
    }
}
